package com.wiscamp.ninechapters.problems.infrastructure.converters;

import com.wiscamp.ninechapters.problems.domain.models.tasks.Task;
import com.wiscamp.ninechapters.problems.infrastructure.po.tasks.TaskPO;
import com.wiscamp.ninechapters.problems.infrastructure.po.tasks.TaskView;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface TaskConverter {
    TaskConverter Instance = Mappers.getMapper(TaskConverter.class);
    TaskPO toTaskPO(Task entity);

    TaskPO toTaskPO(Task entity, @MappingTarget TaskPO po);

    Task toTask(TaskPO po);

    Task toTaskByView(TaskView view);
}
